// pages/fy/fy.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // tab切换  
    currentTab: 0,
    swiperViewHeight: '',
    arr:['.v1','.v2','.v3','.v4'],
    listData:[
      {"cs":"中国台湾","ss":"中国台湾","xz":"3057","xy":"32502","wzz":"0"},
      {"cs":"浦东新区","ss":"上海市","xz":"409","xy":"11589","wzz":"4246" },
      {"cs":"徐汇区","ss":"上海市","xz":"347","xy":"2372","wzz":"1019" },
      {"cs":"黄浦区","ss":"上海市","xz":"192","xy":"2775","wzz":"1560" },
      {"cs":"闵行区","ss":"上海市","xz":"153","xy":"4132","wzz":"650" },
      {"cs":"静安区","ss":"上海市","xz":"150","xy":"1516","wzz":"320" },
      {"cs":"宝山区","ss":"上海市","xz":"136","xy":"1064","wzz":"150" },
      {"cs":"中国香港","ss":"中国香港","xz":"119","xy":"232729","wzz":"0" },
      {"cs":"虹口区","ss":"上海市","xz":"103","xy":"1841","wzz":"321" },
      {"cs":"普陀区","ss":"上海市","xz":"94","xy":"1173","wzz":"922" },
      {"cs":"长宁区","ss":"上海市","xz":"85","xy":"1460","wzz":"411" },
      {"cs":"嘉定区","ss":"上海市","xz":"80","xy":"1641","wzz":"696" },
      {"cs":"青浦区","ss":"上海市","xz":"60","xy":"882","wzz":"325" },
      {"cs":"杨浦区","ss":"上海市","xz":"54","xy":"1198","wzz":"489" },
      {"cs":"长春","ss":"吉林市","xz":"53","xy":"3368","wzz":"211" }
    ],
    listData2:[
      {"bt":"21省已关闭关停的高速收费站服务区","nr":"根据各省（区、市）上报数据汇总统计，受疫情影响，截至2022年4月21日24时，各省(区、市）高速公路共关闭收费站20个，关停服务区24个。除西藏（无高速公路收费站和服务区）外的30个省（区、市）中，北京、天津、山西、内蒙古、辽宁、吉林.黑龙江、福建、江西、山东、河南、湖北、广东、海南、重庆、四川、贵州、新疆等21个省份己无关闭关停的高速公路收费站。","fbr":"丁香医生","sj":"2021-11-28"},
      {"bt":"上海疫情已经连续几日呈下降趋势","nr":"22日，上海疫情防控发布会通报，上海市疫情连续几天呈现下降趋势，其中多区尽三日总体疫情持续下降。","fbr":"人民日报","sj":"2021-11-28"},
      {"bt":"周小川：债务问题不能用单一方式解决，缓债链条拉长有助应对疫情冲击","nr":"周小川认为，从区域性自愿的到全国、全球的碳市场应该统一起来，资源配置会更好。各国边际减碳的成本不一样，导致不同市场的碳价格不一样，最主要是寻找一个最优路径。","fbr":"新浪新闻","sj":"2021-11-28"},
      {"bt":"广州市白云区一酒吧聚集疫情新增感染者12例","nr":"广州市卫生健康委副主任、新闻发言人陈斌：4月12日15时至13日15时，广州新增29例新冠病毒阳性感染者，其中确诊病例21例，无症状感染者8例。具体情况通报如下：白云区管控区域内迪鹿酒吧聚集疫情新增感染者12例，广州富盈国际有限公司聚集疫情新增感染者3例，欧PARK时空创业中心聚集疫情新增感染者2例，小朱养生馆聚集疫情新增感染者1例；新增大冈村聚集疫情感染者7例；在密接、重点人员排查中发现感染者4例。","fbr":"南方日报","sj":"2021-11-28"},
    ],
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  /**
  * 滑动切换tab  
  */
  bindChange: function (e) {
    var that = this;
    that.setData({ currentTab: e.detail.current });
    this.setSwiperHeight(this.data.arr[e.detail.current])
  },
  // 点击tab切换 
  swichNav: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current
      })
    }
  },
  // 赋值高度
  setSwiperHeight: function (v) {
    let query = wx.createSelectorQuery().in(this);
    query.select(v).boundingClientRect();
    query.exec((res) => {
      let headerHeight = res[0].height;
      this.setData({
        swiperViewHeight: headerHeight
      });
    });
  },
    // swiper 自适应高度
    onLoad: function (options) {
        this.setSwiperHeight(this.data.arr[0])
      },
})
